<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fm" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE HTML >
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'login.jsp' starting page</title>
</head>

<body>
	<div>
		<c:if test="${empty userInfo  }">
			<jsp:forward page="login.jsp"></jsp:forward>
		</c:if>
	</div>
	<div>
		<div>
			欢迎：${userInfo.username },<a href="user/exit">退出登录</a>
		</div>
		<div>
			<jsp:include page="left.jsp"></jsp:include>
		</div>

		<div>

			<div>
				<form action="sale/findPageAll" method="post">
					<select name="orderByIndex">
						<c:if test="${orderByIndex eq 1 }">
							<option value="1" selected="selected">销售日期</option>
							<option value="2">单笔总价</option>
						</c:if>
						<c:if test="${orderByIndex eq 2 }">
							<option value="1">销售日期</option>
							<option value="2" selected="selected">单笔总价</option>
						</c:if>
					</select> <input type="submit" />
				</form>
			</div>
			<div>
				<table>
					<tr>
						<td>ID</td>
						<td>商品</td>
						<td>单价</td>
						<td>数量</td>
						<td>总价</td>
						<td>日期</td>
						<td>销售员</td>
					</tr>
					<c:forEach items="${saleList }" var="sale">
						<tr>
							<td>${sale.id }</td>
							<td>${sale.produtname }</td>
							<td>${sale.price }</td>
							<td>${sale.quantity }</td>
							<td>${sale.totalprice }</td>
							<td>
								<fm:formatDate value="${sale.saledate }" pattern="yyyy-MM-dd" />
							</td>
							<td>${sale.username }</td>
						</tr>

					</c:forEach>
					<tr>
						<td colspan="7">
							<a href="sale/findPageAll?indexPage=1">首页</a>
							<a href="sale/findPageAll?indexPage=${indexPage - 1 }">上一页</a>
							<a href="sale/findPageAll?indexPage=${indexPage + 1 }">下一页</a>
							<a href="sale/findPageAll?indexPage=${totalPage }">末页</a>
							
							${indexPage } / ${totalPage } 共${totalTable }记录
						</td>
					</tr>
				</table>
			</div>



		</div>
	</div>
</body>
</html>
